package com.javatop.controller.user;

import com.javatop.pojo.entity.LikeBean;
import com.javatop.pojo.entity.Result;

import com.javatop.service.serviceImpl.UserServiceImpl;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

/**
 * 负责人：霍梓航
 * 功能： 关注功能控制类
 * 传入关注id和被关注id在数据库更新相关行
 */

@RestController
@RequestMapping("/user/like")
@Slf4j
@Api(tags = "关注接口")
public class LikeController {


    //池子里捞一个服务类
    @Autowired
    private UserServiceImpl userService;

    //添加点赞接口
    @PostMapping("/1")
    public Result hitLike(@RequestBody LikeBean likeBean){
        log.info("添加点赞接口{}",likeBean);
        userService.addLike(likeBean);
        return Result.success();
    }
    //取消点赞接口
    @PostMapping("/0")
    public Result deleteLike(@RequestBody LikeBean likeBean){
        log.info("删除关注接口{}",likeBean);
        userService.removeLike(likeBean);
        return Result.success();
    }
    //查询是否点赞
    @PostMapping
    public Result ifConcern(@RequestBody LikeBean likeBean){
        log.info("查询是否关注{}",likeBean);
        return Result.success();
    }


}
